home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / PowerD / Dmod / dmod_P96 / examples / OpenPIP.d < prev    next >
Encoding:
Text File  |  2002-10-28  |  2.0 KB  |  83 lines

  1. /***********************************************************************
  2. * This is an example that shows how to open a p96 PIP Window 
  3. * to get input events and how to paint in that window.
  4. *
  5. * converted by Martin <MarK> Kuchinka, 13.9.2001
  6. ***********************************************************************/
  7.  
  8. MODULE    'picasso96','libraries/picasso96'
  9. MODULE    'graphics/rastport','intuition/intuition'
  10.  
  11. DEF    P96Base
  12.  
  13. PROC main()
  14.     IF P96Base:=OpenLibrary(P96NAME,2)
  15.         DEF    wd:PTR TO Window
  16.  
  17.         DEFL    width = 256,
  18.                 height = 256
  19.         DEF    pubscreenname = 'Workbench'
  20.  
  21.         DEF    ra,array=[0,0,pubscreenname]:L
  22.         IF ra:=ReadArgs('Width=W/N,Height=H/N,Pubscreen=PS/K',array,NIL)
  23.             IF array[0] THEN width :=^array[0]
  24.             IF array[1] THEN height:=^array[1]
  25.             pubscreenname:=array[2]
  26.             FreeArgs(ra)
  27.         ENDIF
  28.  
  29.         IF wd:=p96PIP_OpenTags(
  30.                 P96PIP_SourceFormat, RGBFB_R5G5B5, // RGBFB_Y4U2V2,
  31.                 P96PIP_SourceWidth,  256,
  32.                 P96PIP_SourceHeight, 256,
  33.  
  34.                 /* these tags are optional, but help */
  35.                 WA_Title,           'Picasso96 API PIP Test',
  36.                 WA_Activate,         TRUE,
  37.                 WA_RMBTrap,          TRUE,
  38.                 WA_Width,            width,
  39.                 WA_Height,           height,
  40.                 WA_DragBar,          TRUE,
  41.                 WA_DepthGadget,      TRUE,
  42.                 WA_SimpleRefresh,    TRUE,
  43.                 WA_SizeGadget,       TRUE,
  44.                 WA_CloseGadget,      TRUE,
  45.                 WA_IDCMP,            IDCMP_CLOSEWINDOW,
  46.                 WA_PubScreenName,    pubscreenname,
  47.                 TAG_DONE)
  48.  
  49.             DEF    imsg:PTR TO IntuiMessage
  50.             DEF    goahead=TRUE
  51.             DEF    rp=NIL:PTR TO RastPort
  52.  
  53.             p96PIP_GetTags(wd, P96PIP_SourceRPort, &rp, TAG_END)
  54.  
  55.             IF rp
  56.                 DEFUW    x,y
  57.  
  58.                FOR y:=0 TO height-1
  59.                     FOR x:=0 TO width-1
  60.                         p96WritePixel(rp, x, y, (x*256+y)*256)
  61.                     ENDFOR
  62.                 ENDFOR
  63.             ENDIF
  64.  
  65.             REPEAT
  66.                 WaitPort(wd.UserPort)
  67.                 WHILE imsg:=GetMsg(wd.UserPort)
  68.  
  69.                     SELECT imsg.Class
  70.                     CASE IDCMP_CLOSEWINDOW    goahead:=FALSE
  71.                     ENDSELECT
  72.  
  73.                     ReplyMsg(imsg)
  74.                 ENDWHILE
  75.             UNTILN goahead
  76.  
  77.             p96PIP_Close(wd)
  78.         ELSE PrintF('Can''t open window.\n')
  79.  
  80.         CloseLibrary(P96Base)
  81.     ELSE PrintF('Can''t open picasso96api.library v2+.\n')
  82. ENDPROC
  83.